/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.bomt.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

/**
 * StandardBomSrcTypeEnum
 *
 * @author zhanghongyi
 * @date 2025-01-09
 * @description StandardBomSrcTypeEnum
 */
@Getter
@AllArgsConstructor
public enum StandardBomSrcTypeEnum {
    /**
     * 上传
     */
    UPLOAD("UPLOAD", "上传"),

    /**
     * 原始装机清单
     */
    ORIGINAL("ORIGINAL","原始装机清单"),

    /**
     * 修改
     */
    MODIFY("MODIFY", "修改");

    /**
     * 类型
     */
    private final String type;

    /**
     * 描述
     */
    private final String desc;

    /**
     * 根据类型获取enum
     *
     * @param type 类型
     */
    public static StandardBomSrcTypeEnum getByType(String type) {
        return Arrays.stream(StandardBomSrcTypeEnum.values())
            .filter(typeEnum -> StringUtils.equals(typeEnum.getType(), type))
            .findFirst()
            .orElse(null);
    }
}
